package com.yifeng.repo.micro.service.server.engine.configure;

import com.google.common.collect.Lists;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;

/**
 * Created by daibing on 2023/6/9.
 */
@Data
@ConfigurationProperties(prefix = ForceTransactionProperties.PREFIX)
public class ForceTransactionProperties {

    public static final String PREFIX = "yfcloud.micro.service.engine.transaction";

    /**
     * 启用强事务管理：仅支持带@Service类的方法，即使不带@Transactional，也将字段加上读/写事务
     */
    private boolean enabled = true;

    /**
     * 打印强事务管理的类方法
     */
    private boolean printLog = true;

    /**
     * 强事务支持前缀匹配写事务 - 基础列表
     */
    private List<String> writeMethodPrefixList = Lists.newArrayList(
            "add", "save", "create", "insert", "batchInsert",
            "remove", "delete",
            "edit", "update", "modify",
            "do", "process", "on");

    /**
     * 强事务支持前缀匹配写事务 - 补充列表，将和基础列表整合到一起
     */
    private List<String> extraWriteMethodPrefixList;

    /**
     * 强事务支持前缀匹配排除：默认排除manager
     */
    private List<String> excludeClassNamePrefixList = Lists.newArrayList("com.yifeng.*.server.*.manager.*");

}
